package com.jdbc.dao.impl;

import com.jdbc.DAOBaseImpl;
import com.jdbc.JDBCConnectionUtil;
import com.jdbc.bean.InformationBean;
import com.jdbc.dao.InformationDao;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * Created by CCX on 2018/7/8.
 */
public class InformationDAOImpl extends DAOBaseImpl<InformationBean> implements InformationDao {
    Connection connection;

    public InformationDAOImpl(){
        JDBCConnectionUtil jdbcConnectionUtil= JDBCConnectionUtil.getInstate();
        jdbcConnectionUtil.connectionMySql();
        connection= jdbcConnectionUtil.getConnection();
    }

    public InformationBean getInformationById(long id) {
        String sql="select * from information_base_message where id=?";
        try {
            return get(connection,sql,id);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
